module.exports = app => {
    const {
      INTEGER, DATE, STRING, TEXT
    } = app.Sequelize;
const Article = app.model.define('Article', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    uuid:{ type: STRING, field:'uuid' },
    title: { type: TEXT, field:'title' },
    content:{ type: TEXT,field:'content' },
    picstorage:{ type: STRING,field:'picstorage' },
    channel: { type: INTEGER, field: 'channel' },
    userid: { type: INTEGER, field: 'userid'}
  }, { timestamps: false,tableName:'article' });

  Article.associate=()=>{
    app.model.Article.belongsTo(app.model.User, {
        foreignKey: 'userid',
        targetKey: 'id',
      });
  }
 return Article
}